package com.nulldev.util.concurrency.threadIt.v4.emapi.extensions;

public enum ExecutorFeatureExtensions {
	/* Fallback */

	/**
	 * BLANK extension, should be ignored.
	 */
	BLANK,

	/* Core Feature Sets */

	/**
	 * Executor Slots: Used to provide information regarding the available slots
	 * (tasks) that can be executed within a batch. <br>
	 * Provides: <br>
	 * - executorSupportsSlotCount():B <br>
	 * - executor_getFreeSlots():I
	 */
	EEX_core_executor_slots,
	/**
	 * Provides executor_submitAll(O) which allows a list of Runnables to be
	 * executed directly. <br>
	 */
	EEX_core_submit_all_tasks,
	/**
	 * Used to drain a queue of runnable tasks, with a provided limit of tasks that
	 * can be drained and then batched. <br>
	 * Provides: <br>
	 * - executor_drainTasks(O,I)
	 */
	EEX_core_drain_task_queue,
	/**
	 * Used to submit a task that is allowed to complete within X time. Provides:
	 * <br>
	 * - executeWithin(O,L,O)
	 */
	EEX_core_execute_within_time,
	EEX_core_urgent_task_dispatch,
	/**
	 * Used to indicate if a thread pool or a dedicated thread should be used for
	 * execution. <br>
	 * Can also provide ANY to indicate that any thread type can be used. <br>
	 * Provides: <br>
	 * - execute(O,O)
	 */
	EEX_core_execute_with_preference,

	/* Extended Feature Sets */

	EEX_extended_batch_scheduler,
	/**
	 * Allows the threadIt! Unwinder to be used to track submissions and execution
	 * for debugging purposes. <br>
	 * Provides: <br>
	 * - hookUnwinder(O)
	 */
	EEX_extended_unwinder_debugging,

	/* FT 1.2 */

	EEX_core_execute_every_interval,
	EEX_core_execute_when_condition,

	/* Executor Feature Sets */

	/**
	 * Provides support for executor handled batching, instead of EMAPI's
	 * ASyncScheduling API. <br>
	 * Provides: <br>
	 * - batch(R) <br>
	 * - batchAll(R[]) <br>
	 * - executorSupportsBatching()
	 */
	EEX_executor_native_batching,
	EEX_executor_priority_queues,
	/**
	 * Allows a thread to wait until an executor is fully idle and has no queued or
	 * running tasks. <br>
	 * Provides: <br>
	 * - awaitIdle()
	 */
	EEX_executor_await_idle,
	/**
	 * Marks the final threads within an executor as low priority threads, in which
	 * small tasks should be ran. <br>
	 * WARNING: May provide lower performance and throughput if tasks are assigned
	 * to LOW_PRIORITY. <br>
	 * Provides: <br>
	 * - supportsLPT():B <br>
	 * - isLPTActive():B <br>
	 * - setLPTActive(B) <br>
	 * - getLPTs():I[] <br>
	 * - submitLP(R) <br>
	 * - submitLP(E)
	 */
	EEX_executor_low_priority_threads,
	/**
	 * Provides: <br>
	 * - supportsAttemptableSubmissions():B <br>
	 * - attempt_submit(O):B
	 */
	EEX_executor_attemptable_submissions,
	/**
	 * Provides: <br>
	 * - supportsAttemptableSubmissions2():B <br>
	 * - attempt_submit2(E):B
	 */
	EEX_executor_attemptable_submissions2,
	/**
	 * Provides: <br>
	 * - supportsAttemptableBatchSubmissions():B <br>
	 * - attempt_batch(O):B
	 */
	EEX_executor_attemptable_batch_submissions,
	/**
	 * Provides: <br>
	 * - supportsAttemptableDrainSubmissions():B <br>
	 * - attempt_drain(O,I):I
	 */
	EEX_executor_attemptable_drain_submissions,
	/**
	 * Doesn't provide any functions. <br>
	 * Used as a signal to async-schedulers that they can use small queues instead
	 * of the default. (272 tasks)
	 */
	EEX_executor_sched_accepts_always,
	/**
	 * WIP <br>
	 * TODO: ADD DOCUMENTATION ONCE DONE
	 */
	EEX_tile_batching,
	/**
	 * WIP <br>
	 * TODO: ADD DOCUMENTATION ONCE DONE
	 */
	EEX_executor_task_flags_v1,
	/**
	 * WIP <br>
	 * TODO: ADD DOCUMENTATION ONCE DONE
	 */
	EEX_tile_batching_flags_v1,

	/* Java specific extensions */

	/**
	 * Doesn't provide any functions. <br>
	 * Used as a signal to users that the extractor replaces Java's Concurrency API
	 * with wrappers for threadIt!
	 */
	EEX_compat_native_concurrency_api,

	/* Executor Task Handling */
	/* FT 1.1 */

	EEX_tasks_cancelable,
	EEX_tasks_chainable,
	EEX_tasks_master_slave,

	/* FT 1.2 */

	EEX_tasks_clustered,
	EEX_tasks_cluster_ipc,
	EEX_tasks_recursive,
	EEX_tasks_low_priority,

	/* Executor Queries */

	/**
	 * Allows a user to query if the executor is idle. <br>
	 * Provides: <br>
	 * - executorIsIdle():B
	 */
	EEX_query_is_idle,
	EEX_query_get_executor_load,
	EEX_query_get_active_task_count,
	/**
	 * Allows a user to query if native batching is supported by the executor. <br>
	 * Provides: <br>
	 * - executorSupportsBatching():B
	 */
	EEX_query_batching_supported,
	/**
	 * Allows a user to query if task slots are supported by the executor. <br>
	 * Provides: <br>
	 * - executorSupportsSlotCount():B
	 */
	EEX_query_slots_supported,
	/**
	 * Allows a user to query the host's CPU and its capabilities/layout. <br>
	 * Provides: <br>
	 * - executorSupportsCPULayouts():B - getCPULayout():O - getCPULayout(I):O
	 */
	EEX_query_cpu_layout,
	/**
	 * Allows a user to query if the execution environment allows pinning to threads
	 * or CPUs. <br>
	 * Provides: <br>
	 * - executorSupportsThreadAffinity():B <br>
	 * - executorSupportsThreadPinning():B
	 */
	EEX_query_thread_affinity_supported,
	EEX_query_low_priority_supported,
	/**
	 * Provides: <br>
	 * - executorIsForking():B
	 */
	EEX_query_executor_forking,
	/**
	 * Provides: <br>
	 * - executorAllowLargeBatches():B <br>
	 * - executorPreferredBatchSize():I <br>
	 */
	EEX_query_executor_large_batches,

	/* Executor Debugging */

	EEX_query_debug,

	/* Executor Workarounds */

	/**
	 * Workaround for executors that do not like a scheduler handling submissions to
	 * the executor. <br>
	 * Will redirect all async tasks directly to the executor, batched or not.
	 */
	EEX_workaround_force_native_batching,
	EEX_workaround_force_disable_l1_batching,
	EEX_workaround_force_disable_l2_batching,
}
